import pymysql
from _overlapped import NULL
 
class DBconn: 
    
    def getConn(self):  
        db = pymysql.connect("localhost","root","root","test" )
        if(db!=NULL):
            return db
        else:
            print("连接数据库失败。")
# x = DBconn()
# print("MySql：",x.getConn())